--
-- Created by IntelliJ IDEA.
-- Author: yao.chen
-- Date: 2018/10/10
-- Time: 16:00
-- RewardMiraculousCardRender
--

local ClassRef = app.mvc.createRenderClass(...)

function ClassRef.createWithData(data, node)
    local sprite = ClassRef.extend(node or cc.CSLoader:createNode(Res.RewardDrawPanel_Node_card))
    if node == nil then
        print("node == nil")
        ccui.Helper:doLayout(sprite)
    end
    sprite:init(data)
    return sprite
end

function ClassRef.create(node)
    return ClassRef.createWithData(nil, node)
end

function ClassRef:init(data)
    self.super.init(self, data)
    self:setContentSize(self._ui.Panel:getContentSize())

    self._ui.Panel:setSwallowTouches(false)
    self._Particle = self._ui.Particle
end

function ClassRef:setParticlePlay(b)
    b = b or false
    if b then
        self._Particle:setVisible(true)
        self._Particle:resetSystem()
    else
        self._Particle:setVisible(false)
        self._Particle:stopSystem()
    end
end

function ClassRef:setCanBeTouch(b)
    b = b or false
    self._ui.Panel:setTouchEnabled(b)
end

return ClassRef

